CC = g++
CFLAGS = -g -lpthread -I .. 

ALL = test01p test01n test02p test02n test03p test03n test04p test04n \
	  test05p test05n test06p test06n test07p test07n test08p test08n \
	  test09p test09n test10p test10n test11p test11n test12p test12n \
	  test13p test13n test14p test14n test15p test15n test16p test16n \
	  test17p test17n test18p test18n test19p test19n test20p test20n \
	  test21p test21n test22p test22n test23p test23n test24p test24n \
	  test25p test25n test26p test26n test27p test27n test28p test28n \
	  test29p test29n test30p test30n test31p test31n \
matrix_encode_test bitmatrix_encode_test matrix_print_test bitmatrix_print_test \
matrix_inverse_test bitmatrix_inverse_test matrix_create_schedule_test bitmatrix_create_schedule_test \
matrix_dotprod_test bitmatrix_dotprod_test matrix_prod_test bitmatrix_prod_test matrix_sum_test bitmatrix_sum_test \
matrix_convert_test bitmatrix_convert_test matrix_decode_test bitmatrix_decode_test \
bitmatrix2_convert_test bitmatrix2_create_schedule_test bitmatrix2_dotprod_test bitmatrix2_encode_test \
bitmatrix2_inverse_test bitmatrix2_print_test bitmatrix2_prod_test bitmatrix2_sum_test bitmatrix2_decode_test \
matrix2_convert_test matrix2_create_schedule_test matrix2_dotprod_test matrix2_encode_test \
matrix2_inverse_test matrix2_print_test matrix2_prod_test matrix2_sum_test matrix2_decode_test

all: $(ALL)

test%p: test%p.o
	$(CC) $(CFLAGS) -o $@ $< ../../*-2.o

test%n: test%n.o ../*.cpp
	$(CC) $(CFLAGS) -o $@ $< ../*.o

bitmatrix_%_test: bitmatrix_%_test.o
	$(CC) $(CFLAGS) -o $@ $< ../*.o

matrix_%_test: matrix_%_test.o
	$(CC) $(CFLAGS) -o $@ $< ../*.o

bitmatrix2_%_test: bitmatrix2_%_test.o
	$(CC) $(CFLAGS) -o $@ $< ../../*-2.o

matrix2_%_test: matrix2_%_test.o
	$(CC) $(CFLAGS) -o $@ $< ../../*-2.o

.cpp.o:
	$(CC) $(CFLAGS) -c $*.cpp

clean:
	rm -f *.o *_test $(ALL)
